package com.stu.controller.GetInformationCommon;

import com.stu.Dto.JobPageQueryDTO;
import com.stu.result.PageResult;
import com.stu.result.Result;
import com.stu.serive.*;
import com.stu.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController("")
@RequestMapping("/adminCommon")
public class adminCommon {

    @Autowired
    private ClassInformationService classInformationService;
    @Autowired
    private ScholarshipService scholarshipService;
    @Autowired
    private ViolationService violationService;
    @Autowired
    private ExcuseApplicationService excuseApplicationService;
    @Autowired
    private JobInformationService jobInformationService;
    @Autowired
    private DormitoryRepairService dormitoryRepairService;

    /**
     * 查询所有班干部申请
     */
    @GetMapping("/classInformationAll")
    private Result<List<ClassJobApplicationVo>> classInformationAll(){
        return Result.success(classInformationService.classInformationAll());
    }

    /**
     * 查询所有奖学金申请
     */
    @GetMapping("/scholarshipStuInformationAll")
    private Result<List<ScholarshipStuInformationVo>> selectScholarshipStuInformationAll(){
        return Result.success(scholarshipService.selectScholarshipStuInformationAll());
    }


    /**
     * 查询所有 处分申请
     */
    @GetMapping("/violationApplicationAll")
    private Result<List<ViolationApplicationVo>> selectViolationApplicationAll(){
        return Result.success( violationService.selectViolationApplicationAll());
    }

    /**
     * 查询所有请假申请
     */
    @GetMapping("/excuseApplicationAll")
    private Result<List<ExcuseApplicationVo>> selectStayApplicationAll(){
        return Result.success(excuseApplicationService.selectStayApplicationAll());
    }

    /**
     * 查询所有勤工俭学申请
     */
    @GetMapping("/jobApplicationAll")
    private Result<List<JobApplicationVo>> selectJobApplicationAll(){
        return Result.success(jobInformationService.selectApplicationAll());
    }

    /**
     * 查询所有宿舍维修申请
     */
    @GetMapping("/dormitoryRepairApplicationAll")
    private Result<List<DormitoryRepairVo>> dormitoryRepairApplicationAll(){
        return Result.success(dormitoryRepairService.dormitoryRepairApplicationAll());
    }

    /**
     * 查询工作信息
     */
    @PostMapping("/jobInformation")//分页查询操作
    public Result<PageResult> pageQueryJobInformation(@RequestBody JobPageQueryDTO jobPageQueryDTO){
        log.info("分页查询，参数：{}", jobPageQueryDTO);//查询的页面，展示的数据
        //  PageBean 是一个专门用于分页查询的方法，传入指定的参数即可
        PageResult pageResult = jobInformationService.pageQuery(jobPageQueryDTO);
        return Result.success(pageResult);
    }
}
